# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: Andrea Scarpino <andrea@archlinux.org>

pkgname=baloo
pkgver=5.50.0
pkgrel=2
pkgdesc="A framework for searching and managing metadata"
arch=(x86_64)
url='https://community.kde.org/Frameworks'
license=(LGPL)
depends=(kfilemetadata kidletime kio lmdb)
makedepends=(extra-cmake-modules kdoctools doxygen qt5-tools qt5-declarative)
optdepends=('qt5-declarative: QML bindings')
groups=(kf5)
source=("https://download.kde.org/stable/frameworks/${pkgver%.*}/$pkgname-$pkgver.tar.xz"{,.sig}
       kdebug-367480.patch::"https://cgit.kde.org/baloo.git/patch/?id=2d31a850")
sha256sums=('c6bb8b65e8b1428b35fe0324b0da1416262e6e0b47386ea755a0855fc502c91e'
            'SKIP'
            'e2b949c31d3c7ec5fa80f955b7ed770a5cea386167c415fd4ec8f196bb0f24ff')
validpgpkeys=(53E6B47B45CEA3E0D5B7457758D0EE648A48B3BB) # David Faure <faure@kde.org>

prepare() {
  mkdir -p build

  cd $pkgname-$pkgver
  patch -p1 -i ../kdebug-367480.patch # Fix crash with corrupt data
}

build() {
  cd build
  cmake ../$pkgname-$pkgver \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_INSTALL_LIBDIR=lib \
    -DBUILD_TESTING=OFF \
    -DBUILD_QCH=ON
  make
}

package() {
  cd build
  make DESTDIR="$pkgdir" install
}
